"""Buildings."""

__author__ = 'Josh Oosterman'

import random
from potv import engine
from potv import geom

class Building(object):
  """Base class for all buildings."""
  IMAGE_PATTERN = 'buildings/building_%s.png'
  SPRITES = ['blue', 'brown', 'gray', 'orange', 'purple']

  def __init__(self, location, type=None):
    self.location = location
    if type is None:
      type = random.choice(self.SPRITES)
    self.image = engine.LoadImage(self.IMAGE_PATTERN % type,
                                  origin=geom.Vector(256, 256))
    self.depth = -self.location.y

  def Draw(self, view):
    view.DrawImage(self.image, self.location)



